package test;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * <P> @Author: ideaAdmin
 * <P> TODO: Class
 * <P> TODO:
 * <P> Date: 2022/2/28:16:16
 * <P> Description:
 */
public class MyJedisServer {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(6379);

        //这个是获取一个socket套接字
        Socket accept = serverSocket.accept();

        //通过socket可以获取一个输入流
        InputStream inputStream = accept.getInputStream();

        //通过输入流写入一个byte数组中
        byte[] bytes = new byte[1024];

        inputStream.read(bytes);
        System.out.println(new String(bytes));
        //关闭soket
        accept.close();
        serverSocket.close();
    }
}